package demo;

import java.sql.SQLOutput;
import java.util.function.Predicate;

/**
 * predicate demo
 *
 * @author dingwen
 * 2021.05.19 11:47
 */
public class PredicateDemo {

    public static void main(String[] args) {
        Predicate<String> predicate1 = str -> str.equals("talk");
        Predicate<String> predicate2 = str -> str.equals("test");

        String tip = "talk";
        System.out.println(predicate1.test(tip)); //true
        System.out.println(predicate1.negate().test(tip)); // !true
        System.out.println(predicate1.and(predicate2).test(tip));// true && false
        System.out.println(predicate1.or(predicate2).test(tip)); // true || false

    }
}
